package com.qfedu.microcoupon.template.task;

import com.qfedu.common.redis.annotation.MyLock;
import com.qfedu.microcoupon.template.service.CouponTemplateService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

/**
 * @Classname TemplateTask
 * @Description TODO
 * @Date 2025-09-28 11:05
 * @Created by 老任与码
 */
// @Component
public class TemplateTask {

    @Resource
    private CouponTemplateService couponTemplateService;

    // 每小时处理一次
    // @Scheduled(cron = "0 0 * * * ?")
    @Async
    @Scheduled(cron = "0/10 * * * * ?")
    @MyLock(lockName = "lock:update:template", leaseTime = 10)
    public void updateTemplateExpireStatus() {
        couponTemplateService.updateExpireStatusTask();
    }
}
